{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "import time\n",
    "import glob\n",
    "from PIL import Image, ImageDraw\n",
    "from acl_model import Model\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"data/coco.names\") as fd:\n",
    "    coco_labels = fd.readlines()\n",
    "\n",
    "coco_labels = [i[:-1] for i in coco_labels][0:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "device_id = 1\n",
    "\n",
    "model_path = \"YOLO_v2LASTOM/yolov5x_v2.om\"\n",
    "\n",
    "model = Model(device_id, model_path, model_type=\"yolov5\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "val_data_path_img = \".../coco2017/val2017/*.jpg\" # glob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# pred = non_max_suppression(res_tensor, conf_thres=0.25, iou_thres=0.45, classes=None, agnostic=False) Benchmark tests done with this parameters.\n",
    "# This parameters refers : https://github.com/ultralytics/yolov5/releases/tag/v6.1 Table Notes section.\n",
    "time_list = []\n",
    "for name_img in glob.glob(val_data_path_img): # coco2017 val dataset\n",
    "    img_org_bgr = cv2.imread(name_img)\n",
    "    bboxes,time = model.run1(img_org_bgr)\n",
    "    time_list.append(time)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "print(time_list)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
